<?php

function gene_pool_form($form, &$form_state) {
	$form['name'] = array(
	  '#type' => 'textfield',
	  '#title' => t('Gene pool name'),
	);
	
	$form['description'] = array(
	  '#type' => 'textarea',
	  '#title' => t('Description'),
	);
	
	$form['submit'] = array(
	  '#type' => 'submit',
	  '#value' => t('Submit genotype pool'),
	);

	return $form;
}

function gene_pool_form_submit($form, &$form_state)
{
	global $user;

	if (!user_is_logged_in() || !user_access('Create genotype'))
	{
		drupal_set_message(t('You cannot add gene pool.<br/>You have log in first'));
		return;
	}

	drupal_set_message(t('Submitting values: @values', array('@values' => var_export($form_state['values'], TRUE))));
	$vals = $form_state['values'];
	$to_insert = array(
		'name' => $vals['name'],
		'description' => $vals['description'],
	);
	db_insert('gene_pool')->fields($to_insert)->execute();
}

